<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var \Magento\Payment\Block\Transparent\Iframe $block */
$params = $block->getParams();
?>
<html>
    <head>
        <script>
        <?php if (isset($params['redirect'])): ?>
        window.location="<?php echo $block->escapeUrl($params['redirect']); ?>";
        <?php elseif (isset($params['redirect_parent'])): ?>
            window.top.location="<?php echo $block->escapeUrl($params['redirect_parent']); ?>";
        <?php elseif (isset($params['error_msg'])): ?>
            window.top.alert(<?php /* @noEscape */ echo $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($params['error_msg']); ?>);
            var require = window.top.require;
            require(['Magento_Checkout/js/model/full-screen-loader', 'jquery'], function(fullScreenLoader, $) {
                fullScreenLoader.stopLoader();
                $('[data-role="review-save"]').removeClass('disabled');
            });
        <?php elseif (isset($params['order_success'])): ?>
            window.top.location = "<?php echo $block->escapeUrl($params['order_success']); ?>";
        <?php else: ?>
            var require = window.top.require;
            require(
                [
                    'Magento_Checkout/js/model/quote',
                    'Magento_Checkout/js/action/place-order'
                ],
                function(quote, placeOrderAction) {
                    placeOrderAction({"method": quote.paymentMethod().method}, true);
                }
            );
        <?php endif; ?>
        </script>
    </head>
    <body></body>
</html>
